interface User {
    name: string;
    age: number;
    address: string;
}
interface User1 {
    name: string;
    age: number;
    address: string;
}
function getUser(user: User1): User1 {
    return user; 
}
console.log(getUser({ name: 'Jack', age: 18, address: 'Beijing' }));
interface User2 {
    name: string;
    age: number;
    address: string;
    email: string;
}
let u:User={name:'Jack',age:18,address:'Beijing'};
let u1:User1=u
let u3:User2={name:'pink',age:18,address:'Beijing',email:'jack@163.com'}
console.log(u===u1);
//let u2:User2=u1; //User2接口比User1接口多了一个email属性，所以User2接口不能赋值给User1接口
let u2:User1=u3; //User1接口比User2接口少了一个email属性，所以User1接口可以赋值给User2接口
console.log(u2);//{ name: 'pink', age: 18, address: 'Beijing', email: 'jack@163.com' }
console.log(u1===u3) //false
console.log(u===u3) //false



// class UserInfo {
//     name: string;
//     age: number;
//     address: string;
//     email: string;
//     constructor(name: string, age: number, address: string, email: string) {
//         this.name = name;
//         this.age = age;
//         this.address = address;
//         this.email = email; 
//     }
// }
// let user: User = { name: 'Jack', age: 18, address: 'Beijing' };
// let user1: User1 = { name: 'Jack', age: 18, address: 'Beijing' };
// console.log(user===user1);
// let userInfo: User1 = new UserInfo('Jack', 18, 'Beijing',  'jack@163.com');
// console.log(user);
// console.log(user1);
// console.log(userInfo);